<template>
  <!-- 卖家查询条件 -->
  <view class="bgf">
    <u-dropdown
      inactive-color="#333"
      active-color="#333"
      menu-icon="arrow-down-fill"
      menu-icon-size="20"
    >
      <u-dropdown-item title="全部团购  ">
        <view class="bgf">
          <view class="linh-50 tc fw5 fz-16">团购</view>
          <view style="height: 92rpx">
            <u-tabs
              active-color="#E44435"
              height="92"
              inactive-color="#000000"
              font-size="28"
              name="label"
              bar-width="75"
              :list="groupBuyList"
              :is-scroll="false"
              :current="groupBuyIndex"
              @change="_changeGroupBuy"
            ></u-tabs>
          </view>
          <view class="px32 linh-48 justify-between items-center">
            <view>全部团购</view>
            <u-checkbox-group>
              <u-checkbox v-model="allSelect" shape="circle" size="30" active-color="#E44435"></u-checkbox>
            </u-checkbox-group>
          </view>
          <scroll-view style="height: 300rpx" scroll-y>
            <view v-for="(item, index) in tableList" :key="index" class="px32 u-p-t-25 u-p-b-25">
              <view class="ov1">{{item.title}}</view>
              <view class="u-p-t-8 viceColor">{{item.createTime}}</view>
            </view>
          </scroll-view>
        </view>
      </u-dropdown-item>
      <u-dropdown-item title="全部日期  ">
        <view class="bgf"> </view>
      </u-dropdown-item>
    </u-dropdown>
  </view>
</template>
<script>
import orderApi from "@/api/orderApi.js";

export default {
  data(){
    return {
      groupBuyList: [
        {label: "全部"},
        {label: "我发布的"},
        {label: "我帮卖的"}
      ],
      groupBuyIndex: 0,
      allSelect: false, // 是否全部选择
      postParams: {
        currentPage: 1,
        pageSize: 10,
        type: null // null全部,0:我发布的,1:我帮卖的
      },
      tableList: [],
    }
  },
  created(){
    this._getDynamicListForOrder()
  },
  methods:{
    // tabs切换
    _changeGroupBuy(index){
      this.groupBuyIndex = index
      this.postParams.currentPage = 1
      this._getDynamicListForOrder()
    },
    _changeAll(){
      this.allSelect = true
    },
    // 获取团购列表
    _getDynamicListForOrder(){
      if(this.groupBuyIndex === 0){
        this.postParams.type = null
      }else if(this.groupBuyIndex === 1){
        this.postParams.type = 0
      }else{
        this.postParams.type = 1
      }
      orderApi.getDynamicListForOrder(this.postParams).then(res=>{
        this.tableList = res.data.records
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.bgf{
  background: #fff;
}
.ov1{
  @include toe();
}
</style>
